<template>
	<view>
		<view class="header status_bar" :class="scrrol == true ? 'scrrolHeader' : ''">
			<view class="back iconfont icon-xiangzuo1" @tap="backTo()"></view>
			<view class="text" :class="scrrol == true ? 'scrrolHeader' : ''">约定覆约</view>
		</view>	
		<view class="bg_box">
			<image class="bg01" src="/static/bg05.png" mode="widthFix"></image>
			<view class="bg_content">
				<view class="limit_box">
					<view class="title">全部待覆约 (元)</view>
					<view class="num">{{all_money}}</view>
					<view class="rule">{{end_stage.pay_date}}（最后还款日）待还{{end_stage.money}}元</view>
				</view>
				<view class="page_title">
					<view class="title">使用中的签约（共{{num1}}笔）</view>
					<!-- <view class="arrow iconfont icon-xiangyou1"></view> -->
				</view>
				<block v-for="(item, index) in loans_one" :key="index">
					<view class="contract_list">
						<view class="time_box">
							<view class="time">签约时间：{{$u.timeFormat(item.check_time, 'yyyy/mm/dd')}}</view>
							<view class="text" :data-url="'/pages/personalcenter/appoint/details?id='+item.id" @click="gotopage">详情</view>
						</view>
						<view class="contract_text">
							<view class="text_box">
								<view class="money_box">
									<view class="money">{{item.money}}</view>
									<view class="tag">年利率:{{item.cur_rate-0}}%</view>
								</view>
								<view class="period_box">
									<view class="period">共{{item.loans_num}}期  免息{{item.free_day}}天</view>
									<view class="money">初始账单:{{$u.timeFormat(item.stat_day,'yyyy/mm/dd')}}</view>
								</view>
							</view>
							<view class="menu" :data-url="'/pages/personalcenter/appoint/retreaty?id='+item.id" @click="gotopage">立即覆约</view>
						</view>
						<view class="rule_box">
							<view class="rule">出单时间：</view>
							<view class="time">{{$u.timeFormat(item.send_time, 'yyyy年mm月dd日') }}</view>
						</view>
					</view>
				</block>
				<view style="margin-top: 20vw;" v-if="loans_one==0">
					<u-empty mode="data" iconSize="120" ></u-empty>
				</view>
				
				
				<view class="page_title">
					<view class="title">已覆约（共{{num2}}笔）</view>
					<!-- <view class="arrow iconfont icon-xiangyou1"></view> -->
				</view>
				<block v-for="(item, index) in loans_two" :key="index">
					<view class="contract_list">
						<view class="time_box">
							<view class="time">创建时间：{{item.create_time}}</view>
							<view class="text" :data-url="'/pages/personalcenter/appoint/details02?id='+item.id" @click="gotopage">详情</view>
						</view>
						<view class="contract_text">
							<view class="text_box">
								<view class="money_box">
								<view class="money">{{item.money}}</view>
								<view class="tag">年利率:{{item.cur_rate}}%</view>
								</view>
								<view class="period_box">
									<view class="period">共{{item.loans_num}}期  免息{{item.free_day}}天</view>
									<view class="money">初始账单日：{{$u.timeFormat(stat_day, 'yyyy年mm月dd日')}}</view>
								</view>
							</view>
							<view class="icon iconfont icon-a-icon-gaizhangyijieqing"></view>
						</view>
						<view class="rule_box">
							<view class="rule">出单时间：</view>
							<view class="time">{{$u.timeFormat(item.send_time, 'yyyy年mm月dd日')}}</view>
						</view>
					</view>
				</block>
				
				<view style="margin-top: 20vw;" v-if="loans_two.length==0">
					<u-empty mode="data" iconSize="120" ></u-empty>
				</view>
				
				<view class="clear_box"></view>
				
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page:1,
				scrrol:false,
				info:'',
				stat_day : '',
				all_money : '',
				end_stage : '',
				loans_one : '',
				loans_two : '',
				num1 : 0,
				num2 : 0,
				
			}
		},
		onReachBottom() {
		
		},
		onLoad() {
             this.initData();
		},
		methods: {
			setRule(e){
				let that = this;
				let index = e.currentTarget.dataset.index;
				that.flowList[index].tick = !that.flowList[index].tick
			},
			initData() {
		         let url = this.site_url + 'api/auth/loans/loans_init';
				 this.areq(url).then(res=>{
					 if(res.code == 1){
						  let ret = res.data;
						  this.all_money = ret.all_money;
						  this.end_stage = ret.end_stage;
						  this.loans_one = ret.loans_one;
						  this.loans_two = ret.loans_two;
						  this.num1 = ret.num1;
						  this.num2 = ret.num2; 
					 }
				 })
			},
			gotopage(e) {
				let url = e.currentTarget.dataset.url;
				this.$r(url);
			},

		},
		onPageScroll: function(Object) {
			if (Object.scrollTop > 28) {
				this.scrrol = true;
			} else if (Object.scrollTop < 28) {
				this.scrrol = false;
			}
		},
	
	}
</script>

<style>
	
	.header{
		background-color: transparent !important;
	}
	
	.header .text{
		background-color: transparent !important;
		color: #333 !important;
	}
	
	.scrrolHeader{
		background-color: #F9E9E3 !important;
	}
	
	.bg_box{
		width: 100%;
		position: relative;
	}
	
	.bg_box .bg01{
		width: 100%;
	}
	
	.bg_box .bg_content{
		width: 92%;
		position: absolute;
		left: calc(50% - 46%);
		top: calc(13.5vw + var(--status-bar-height));
		z-index: 98;
	}
	
	.limit_box{
		width: 100%;
		background-color: #fff;
		border-radius: 3vw;
		padding: 6vw 0;
		margin-top: 4%;
	}
	
	.limit_box .title{
		font-size: 3.6vw;
		color: #333;
		font-weight: bold;
		text-align: center;
	}
	
	.limit_box .num{
		font-size: 13vw;
		color: #333;
		font-weight: bold;
		margin-top: 3vw;
		text-align: center;
	}
	
	.limit_box .rule{
		font-size: 3.4vw;
		color: #715439;
		margin-top: 3vw;
		text-align: center;
	}
	
	.limit_box .text{
		font-size: 3.4vw;
		color: #666666;
		margin-top: 3vw;
		text-align: center;
	}
	
	.page_title{
		width: 100%;
		margin-top: 4%;
		display: flex;
		align-items: center;
	}
	
	.page_title .title{
		font-size: 4.5vw;
		color: #333;
		font-weight: bold;
		flex: 1;
	}
	
	.page_title .arrow{
		font-size: 4vw;
		color: #999;
	}
	
	.contract_list{
		width: 100%;
		background-color: #fff;
		border-radius: 3vw;
		margin-top: 4%;
		padding-bottom: 5%;
	}
	
	.contract_list .time_box{
		width: 100%;
		height: 13vw;
		padding: 0 4%;
		display: flex;
		align-items: center;
		border-bottom: 1px solid #F3F3F3;
	}
	
	.contract_list .time_box .time{
		font-size: 3.5vw;
		color: #3B3B3B;
		flex: 1;
	}
	
	.contract_list .time_box .text{
		flex: 1;
		font-size: 3.5vw;
		color: #999999;
		text-align: right;
	}
	
	.contract_list .contract_text{
		width: 100%;
		display: flex;
		align-items: center;
		padding: 4vw;
	}
	
	.contract_list .contract_text .menu{
		width: 24vw;
		color: #fff;
		height: 10vw;
		line-height: 10vw;
		border-radius: 10vw;
		text-align: center;
		font-size: 3.5vw;
		background-color: #FC5D20;
	}
	
	.contract_list .contract_text .icon{
		font-size: 20vw;
		color: #D1D1D1;
	}
	
	.contract_list .contract_text .text_box{
		flex: 1;
	}
	
	.contract_list .contract_text .text_box .money_box{
		width: 100%;
		display: flex;
		align-items: center;
	}
	
	.contract_list .contract_text .text_box .money_box .money{
		font-size: 7vw;
		color: #333;
		font-weight: bold;
		margin-right: 1vw;
	}
	
	.contract_list .contract_text .text_box .money_box .tag{
		font-size: 2.6vw;
		color: #fff;
		background-color: #FF4246;
		height: 5vw;
		padding: 0 2vw;
		border-radius: 3vw 3vw 3vw 1.5vw;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	
	.contract_list .contract_text .text_box .money_box .tag02{
		background-color: #D1D1D1;
	}
	
	.contract_list .contract_text .text_box .period_box{
		width: 100%;
		display: flex;
		align-items: center;
		margin-top: 2vw;
	}
	
	.contract_list .contract_text .text_box .period_box .period{
		font-size: 3.5vw;
		color: #333;
		margin-right: 2vw;
	}
	
	.contract_list .contract_text .text_box .period_box .money{
		font-size: 3.5vw;
		color: #919191;
	}
	
	.contract_list .rule_box{
		width: 92%;
		padding: 0 3vw;
		height: 10vw;
		background-color: #FFFAF6;
		display: flex;
		align-items: center;
		margin: 0 auto;
		border-radius: 2vw;
		
	}
	
	.contract_list .rule_box .rule{
		font-size: 3.5vw;
		color: #666666;
		margin-right: 1vw;
	}
	
	.contract_list .rule_box .time{
		font-size: 3.4vw;
		color: #FC5D20;
	}
	
	

	
	
	
</style>
